package com.niguang.work.api.entity;

import java.util.Date;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * <p>
 * 'work.v_personSite' is not BASE TABLE
 * </p>
 *
 * @author 12380
 * @since 2018-09-06
 */
@TableName("work_reform_apply")
@Data
public class ReformApply extends Model<ReformApply> {

    private static final long serialVersionUID = 1L;

    private Long id;
    /**
     * 整改表单ID
     */
    @NotNull(message = "整改表单[contentId]不能为空~")
    private Long contentId;
    /**
     * 审核人公众号openId
     */
    private String applyOpenId;
    /**
     * 审核人用户id
     */
    private String applyUserId;
    /**
     * 审核人用户姓名
     */
    private String applyUserName;
    /**
     * 审核人电话号码
     */
    private String applyUserPhone;
    /**
     * 审核人工作职位
     */
    private String applyJobPosition;
    /**
     * 隐患级别 1-一般 2-较大 3-重大 4-特大
     */
    private Integer dangerLevel;

    /**
     * 积分
     */
    @TableField(exist = false)
    private Integer integral;


    /**
     * 整改期限
     */
    private String reformTerm;
    /**
     * 指派人id
     */
    //@NotNull(message = "责任人不能为空！")
    private String appointUserId;
    /**
     * 指派人姓名
     */
    private String appointUserName;
    /**
     * 指派人手机号码
     */
    private String appointUserPhone;
    /**
     * 指派人职位
     */
    private String appointJobPosition;

    private String appointOpenId;

    private String ccUserName;

    private String ccUserId;
    /**
     * 隐患图片
     */
    private String dangerPic;
    /**
     * 隐患描述
     */
    private String dangerDesc;
    /**
     * 操作节点步骤 1-审核分发 2-整改处理 3-复查处理 4-整改驳回 5-转发
     */
    @NotNull(message = "操作节点步骤不能为空~")
    private Integer nodeStep;

    @TableField(exist = false)
    private Integer nodeStep1;

    /**
     * 是否处理 0-未处理 1-已处理
     */
    private Integer dealFlag;

    /**
     * 是否有效 0--无效 1-有效
     */
    private Integer validFlag;

    private Integer formFlag;


    /**
     * 审核状态 1-无需整改 2-待整改 3-通过 4-不通过
     */
    private Integer applyFlag;
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    public ReformApply() {
    }

    /**
     * 节点操作审核人完成状态
     *
     * @param id
     * @param dealFlag
     */
    public ReformApply(Long id, Integer dealFlag) {
        this.id = id;
        this.dealFlag = dealFlag;
    }

    /**
     * 审核人构造器
     */
    public ReformApply(Long contentId, String applyOpenId, String applyUserName, String applyUserPhone,
                       String applyJobPosition, Integer dangerLevel, Integer integral, String reformTerm, String appointUserId,
                       String appointUserName, String appointUserPhone, String appointJobPosition, String appointOpenId,
                       String ccUserName, String ccUserId, Integer nodeStep, Integer applyFlag, Integer formFlag) {
        this.contentId = contentId;
        this.applyOpenId = applyOpenId;
        this.applyUserId = applyOpenId;
        this.applyUserName = applyUserName;
        this.applyUserPhone = applyUserPhone;
        this.applyJobPosition = applyJobPosition;
        this.dangerLevel = dangerLevel;
        this.integral = integral;
        this.reformTerm = reformTerm;
        this.appointUserId = appointUserId;
        this.appointUserName = appointUserName;
        this.appointUserPhone = appointUserPhone;
        this.appointJobPosition = appointJobPosition;
        this.appointOpenId = appointOpenId;
        this.ccUserName = ccUserName;
        this.ccUserId = ccUserId;
        this.nodeStep = nodeStep;
        this.applyFlag = applyFlag;
        this.formFlag = formFlag;
    }


    /**
     * 整改人构造器
     */
    public ReformApply(Long id, Long contentId, String applyOpenId, String applyUserName, String applyUserPhone, String applyJobPosition,
                       String appointUserId, String appointUserName, String appointUserPhone, String appointJobPosition, String appointOpenId,
                       String ccUserName, String ccUserId, String dangerPic, String dangerDesc, Integer nodeStep, Integer nodeStep1, Integer formFlag) {
        this.id = id;
        this.contentId = contentId;
        this.applyOpenId = applyOpenId;
        this.applyUserId = applyOpenId;
        this.applyUserName = applyUserName;
        this.applyUserPhone = applyUserPhone;
        this.applyJobPosition = applyJobPosition;
        this.appointUserId = appointUserId;
        this.appointUserName = appointUserName;
        this.appointUserPhone = appointUserPhone;
        this.appointJobPosition = appointJobPosition;
        this.appointOpenId = appointOpenId;
        this.ccUserName = ccUserName;
        this.ccUserId = ccUserId;
        this.dangerPic = dangerPic;
        this.dangerDesc = dangerDesc;
        this.nodeStep = nodeStep;
        this.nodeStep1 = nodeStep1;
        this.applyFlag = nodeStep;
        this.formFlag = formFlag;
    }


    /**
     * 复查人
     */
    public ReformApply(Long id, Long contentId, String applyOpenId, String applyUserName, String applyUserPhone, String applyJobPosition,
                       String ccUserName, String ccUserId, String dangerPic, String dangerDesc, Integer nodeStep, Integer applyFlag, Integer formFlag) {
        this.id = id;
        this.contentId = contentId;
        this.applyOpenId = applyOpenId;
        this.applyUserId = applyOpenId;
        this.applyUserName = applyUserName;
        this.applyUserPhone = applyUserPhone;
        this.applyJobPosition = applyJobPosition;
        this.ccUserName = ccUserName;
        this.ccUserId = ccUserId;
        this.dangerPic = dangerPic;
        this.dangerDesc = dangerDesc;
        this.nodeStep = nodeStep;
        this.applyFlag = applyFlag;
        this.formFlag = formFlag;
    }


    /**
     * 根据id修改指派人
     */
    public ReformApply(Long id, String appointUserName, String appointUserPhone,
                       String appointJobPosition, String appointOpenId, String ccUserName, String ccUserId,
                       String dangerPic, String dangerDesc, Integer applyFlag, Integer nodeStep) {
        this.id = id;
        this.appointUserId = appointOpenId;
        this.appointUserName = appointUserName;
        this.appointUserPhone = appointUserPhone;
        this.appointJobPosition = appointJobPosition;
        this.appointOpenId = appointOpenId;
        this.dealFlag = 1;
        this.ccUserName = ccUserName;
        this.ccUserId = ccUserId;
        this.dangerPic = dangerPic;
        this.dangerDesc = dangerDesc;
        this.applyFlag = applyFlag;
        this.nodeStep = nodeStep;
    }


    /**
     * 根据id修改指派人
     */
    public ReformApply(Long id, String appointUserName, String appointUserPhone,
                       String appointJobPosition, String appointOpenId, String ccUserName, String ccUserId,
                       String dangerPic, String dangerDesc, Integer applyFlag) {
        this.id = id;
        this.appointUserId = appointOpenId;
        this.appointUserName = appointUserName;
        this.appointUserPhone = appointUserPhone;
        this.appointJobPosition = appointJobPosition;
        this.appointOpenId = appointOpenId;
        this.dealFlag = 1;
        this.ccUserName = ccUserName;
        this.ccUserId = ccUserId;
        this.dangerPic = dangerPic;
        this.dangerDesc = dangerDesc;
        this.applyFlag = applyFlag;
    }

    /**
     * 存入数据：整改/复查人
     */
    public ReformApply(Long contentId, String applyOpenId, String applyUserName, String applyUserPhone,
                       String applyJobPosition, Integer nodeStep, Integer dangerLevel, String reformTerm, Integer formFlag) {
        this.id = null;
        this.contentId = contentId;
        this.applyOpenId = applyOpenId;
        this.applyUserId = applyOpenId;
        this.applyUserName = applyUserName;
        this.applyUserPhone = applyUserPhone;
        this.applyJobPosition = applyJobPosition;
        this.nodeStep = nodeStep;
        this.dangerLevel = dangerLevel;
        this.reformTerm = reformTerm;
        this.formFlag = formFlag;
    }


    public static final String ID = "id";

    public static final String CONTENT_ID = "content_id";

    public static final String APPLY_OPEN_ID = "apply_open_id";

    public static final String APPLY_USER_ID = "apply_user_id";

    public static final String APPLY_USER_NAME = "apply_user_name";

    public static final String APPLY_USER_PHONE = "apply_user_phone";

    public static final String APPLY_JOB_POSITION = "apply_job_position";

    public static final String DANGER_LEVEL = "danger_level";

    public static final String REFORM_TERM = "reform_term";

    public static final String APPOINT_USER_ID = "appoint_user_id";

    public static final String APPOINT_USER_NAME = "appoint_user_name";

    public static final String APPOINT_USER_PHONE = "appoint_user_phone";

    public static final String APPOINT_JOB_POSITION = "appoint_job_position";

    public static final String DANGER_PIC = "danger_pic";

    public static final String DANGER_DESC = "danger_desc";

    public static final String NODE_STEP = "node_step";

    public static final String APPLY_FLAG = "apply_flag";

    public static final String CREATE_TIME = "create_time";

    public static final String UPDATE_TIME = "update_time";

    public static final String CC_USER_NAME = "cc_user_name";

    public static final String APPOINT_OPEN_ID = "appoint_open_id";

    public static final String DEAL_FLAG = "deal_flag";

    public static final String VALID_FLAG = "valid_flag";

    public static final String FORM_FLAG = "form_flag";


    @Override
    protected Serializable pkVal() {
        return this.id;
    }
}
